package com.mojo.web.pojo;

import org.apache.kafka.common.serialization.Serializer;

import java.util.StringJoiner;

/**
 * @author <a href="mailto:mojo_jj@163.com">Mojo</a>
 */
public class User implements Serializer<User> {
    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", User.class.getSimpleName() + "[", "]")
                .add("name='" + name + "'")
                .add("age=" + age)
                .toString();
    }

    @Override
    public byte[] serialize(String topic, User user) {

        return user.toString().getBytes();
    }
}
